Gap Filling Strategy Gaps are market prices structures that appear frequently in the stock market, and can be detected when the opening price is different from the previous closing price, this is why gaps are also called "opening price jumps". While gaps can occur frequently, some of them are more significant than others, and can be observed when looking at a long term chart.
The following strategy is based on the exploitation of significant gaps occurring during a new session, and posses various options that can return a wide variety of results.
 Type Of Gaps And Occurence 
I'am not a professional when it comes to gaps, but as you know the stock market close for the day, however it is still possible to place orders, your broker will hold them until the market open back. Once the market reopen the broker execute the pending orders, and when many orders where pending the market register really high volume and the price might differ from the precedent close. 
Gaps are generally broken down into four types:
 
  Common : Gaps occurring within a certain price range, mostly occurs during ranging markets.
  Break Away : Gaps breaking a support and resistance, making a new higher high/lower low.
  Runaway : Gaps occurring within a trend, followed by a continuation of the trend.
  Exhaustion : Gaps occurring at the end of a trend, followed by a reversal.
 
As said before, some gaps are more significant than others, the significance of a gap can be determined by comparing the opening price with the previous high/low price and by looking at volume. Significant up gaps will have an opening price greater than the previous high, while significant down gap will have an opening price lower than the previous low with both high volume accompanying them.
After a gap, when the price go back to the point previous to the gap we say that it has been "filled", this characteristic is what will be exploited in this strategy.
 Strategy Rules & Logic 
In this strategy, the significance of a gap is determined by the position of the opening price relative to the previous high/low and make sure the bar following the gap don't fill it.
When the setting  invert  is set to false the strategy interpret the detected gaps as being exhaustion gaps, therefore when an up gap occur a short position is opened, when a down gap occur a long position is opened. When invert is set to true gaps are considered to be runaway or break away gaps, therefore the contrary positions are opened. Positions are exited when the gap has been filled, which in the chart is show'n when the price cross the red level who act as either a take profit (invert = false) or as a stop loss (invert = true).
There are various closing conditions available that the user can select from the "close when" setting. 
 
  New Session : This option close all previous positions when the market is in a new session.
  New Gap : This option close all previous position when a new gap has been detected.
  Reverse Position : This option close all previous position when a contrary position to the current one is opened. This option would reduce the number of trades.
 
 Testing On Some Stocks 
The analysis will be tested in different tech stocks with a main TF of 15 minutes with no spread and commissions applied. Default settings will be used. We'll be making our first analysis using AMD, who has recently formed a full reverse HS pattern, where the neckline has been crossed by the price. (by the way i have a bad feeling about it, hey ! feeling  filling  ! Lame jokes!)
Profit: $ -12.22
Trades: 272
Profitability: 65.07 %
We can see negative results, with an heavily decreasing balance. Using invert would return positive results.
We will now test the strategy on NVDA, the company is one of the biggest when it comes to the Gpu market.
Profit: $ -215.54
Trades: 297
Profitability: 60.27 %
Not better, using invert would of course create better results. Like AMD the balance is heavily decreasing.
Finally we will test the strategy on Seagate technology, a company mostly known for their mechanical hard drives.
Profit: $ -4.32
Trades: 261
Profitability: 65.9 %
Here the balance does not appear so heavily decreasing and even managed to reach back the initial balance before going down again.
 Summary 
A strategy based on gap filling has been briefly introduced and tested with 3 tech stocks. The results show that using invert option might be better. The advantage of this strategy against ones using technical indicators is that this one does not heavily depend on user settings, which make it way more efficient, this a big advantage of patterns based strategies.
Thx to LucF for helping with the "process_orders_on_close" element, since i had to use closing price i had to remove it tho, was afraid results would differ even more from a more realistic backtest. And thx for those who continuously support me, more cool stuff is coming up.
Thx for reading and i hope you'll have learned something new today !
Cari skrip untuk "the strat"
Combo Backtest 123 Reversal & Dynamo This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 In July 1996 Futures magazine, E. Marshall Wall introduces the 
 Dynamic Momentum Oscillator (Dynamo). Please refer to this article 
 for interpretation.
 The Dynamo oscillator is a normalizing function which adjusts the 
 values of a standard oscillator for trendiness by taking the difference 
 between the value of the oscillator and a moving average of the oscillator 
 and then subtracting that value from the oscillator midpoint.
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Strategy 123 Reversal & DynamoThis is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 In July 1996 Futures magazine, E. Marshall Wall introduces the 
 Dynamic Momentum Oscillator (Dynamo). Please refer to this article 
 for interpretation.
 The Dynamo oscillator is a normalizing function which adjusts the 
 values of a standard oscillator for trendiness by taking the difference 
 between the value of the oscillator and a moving average of the oscillator 
 and then subtracting that value from the oscillator midpoint.
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Backtest 123 Reversal & Dynamic Pivot Point This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 This Pivot points is calculated on the current day.
 Pivot points simply took the high, low, and closing price from the previous period and 
 divided by 3 to find the pivot. From this pivot, traders would then base their 
 calculations for three support, and three resistance levels. The calculation for the most 
 basic flavor of pivot points, known as ‘floor-trader pivots’, along with their support and 
 resistance levels.
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Strategy 123 Reversal & Dynamic Pivot Point This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 This Pivot points is calculated on the current day.
 Pivot points simply took the high, low, and closing price from the previous period and 
 divided by 3 to find the pivot. From this pivot, traders would then base their 
 calculations for three support, and three resistance levels. The calculation for the most 
 basic flavor of pivot points, known as ‘floor-trader pivots’, along with their support and 
 resistance levels.
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
My VWAP Reversal + Pivot Points StandardThis indicator, with the addition of a standard VWAP indicator to the 5m chart, helps the operator when using a closing candle Price to initiate a VWAP Reversal strategy.
The strategy involves Price gapping up, look for a Close below the 1st 5m candle Low; else look for a Close above the 1st 5m candle High. On a break of VWAP, take the trade in the opposite direction of the gap, hence the VWAP Reversal. Not my own strat, credit to T3 Newsbeat, publicly posted on YouTube.
The Pivot Points Standard in the Pine 4 user manual, was the base source code, and leaving it here will allow me to remove the PP indicator I was using.
Combo Backtest 123 Reversal & Dynamic Momentum Index This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 This indicator plots Dynamic Momentum Index indicator. The Dynamic Momentum 
 Index (DMI) was developed by Tushar Chande and Stanley Kroll. The indicator 
 is covered in detail in their book The New Technical Trader.
 The DMI is identical to Welles Wilder`s Relative Strength Index except the 
 number of periods is variable rather than fixed. The variability of the time 
 periods used in the DMI is controlled by the recent volatility of prices. 
 The more volatile the prices, the more sensitive the DMI is to price changes. 
 In other words, the DMI will use more time periods during quiet markets, and 
 less during active markets. The maximum time periods the DMI can reach is 30 
 and the minimum is 3. This calculation method is similar to the Variable 
 Moving Average, also developed by Tushar Chande.
 The advantage of using a variable length time period when calculating the RSI 
 is that it overcomes the negative effects of smoothing, which often obscure short-term moves.
 The volatility index used in controlling the time periods in the DMI is based 
 on a calculation using a five period standard deviation and a ten period average 
 of the standard deviation.
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Strategy 123 Reversal & Dynamic Momentum Index This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 This indicator plots Dynamic Momentum Index indicator. The Dynamic Momentum 
 Index (DMI) was developed by Tushar Chande and Stanley Kroll. The indicator 
 is covered in detail in their book The New Technical Trader.
 The DMI is identical to Welles Wilder`s Relative Strength Index except the 
 number of periods is variable rather than fixed. The variability of the time 
 periods used in the DMI is controlled by the recent volatility of prices. 
 The more volatile the prices, the more sensitive the DMI is to price changes. 
 In other words, the DMI will use more time periods during quiet markets, and 
 less during active markets. The maximum time periods the DMI can reach is 30 
 and the minimum is 3. This calculation method is similar to the Variable 
 Moving Average, also developed by Tushar Chande.
The advantage of using a variable length time period when calculating the RSI 
 is that it overcomes the negative effects of smoothing, which often obscure short-term moves.
 The volatility index used in controlling the time periods in the DMI is based 
 on a calculation using a five period standard deviation and a ten period average 
 of the standard deviation.
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Backtest 123 Reversal & DSS Bressert This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 Double Smoothed Stochastics (DSS) is designed by William Blaw. 
 It attempts to combine moving average methods with oscillator principles. 
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Strategy 123 Reversal & DSS Bressert This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 Double Smoothed Stochastics (DSS) is designed by William Blaw. 
 It attempts to combine moving average methods with oscillator principles. 
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Patient Trendfollower (7)(alpha)Patient Trendfollower consists of 21 and 55 EMA, Commodity Channel Index and Supertrend indicator. It confirms a trend and gives you a signal on a pullback. Original creation worked on 1h EURUSD chart.
  
►Long setup:
• 21 EMA is above 55 EMA, which is above the Supertrend indicator.
• Commodity Channel Index is an oscillator, which prints into the chart if extreme levels are reached. Green is for a level above 100 or below -100, red is above 140 or below -140 and black is above 180 or below -180. 
• If 21 EMA > 55EMA > Supertrend and an oversold signal appear, you can buy into the trend.
• When backtesting on 1h EURUSD, profit target 400 pips worked best with a stop-loss below Supertrend's bottom and the size of your spread.
• A picture shows two valid entries.
 : This part still malfunctions and shows red dots over some green ones. It is important to disable red ones in the settings to see green ones.
Some more long signals:
  
Some short signals:
  
►Backtesting data with default settings and trading only green CCI signals with mentioned risk management strategy:
• 212 closed trades
• 58.96% profitable with average win trade 348 USD and average loss trade 263 USD when only green signals are followed.
• Profit factor 1.903, Sharpee 0.792
• 20 bars is average for all trades, short trades were 18 bars long on average.
With given data, you can see the strategy is profitable by itself. However, original risk management settings do work only on 1h charts of EURUSD and would need to be adjusted for other instruments based on average volatility.
Even though the profitability is low, you can increase your odds by a great margin, if you properly use price action (impulsive and corrective moves, patterns, bar analysis), if you trade when major exchanges are open, you may also use wave analysis such as Elliot Waves or Market Profiles to predict whether the next day might be a trending day. My backtesting program didn't consider these ideas.
Unfortunately, I won't be making backtesting strategy public with it anytime soon, because it still has some parts that do not work. I am ok with that since I understand the code and know what does malfunction and how. Then, there are parts which I am not sure how to fix yet. This is why the indicator is still considered alpha.
In the future when a strategy is published, you will also be able to set your own overbought/oversold values without entering the code itself and probably some other features. But I am not in a hurry for that. You can give me feedback on UX and try to figure out the best setups for other symbols, it might help to improve the automatic testing script when I know what I should achieve. My main point is to make this public for friends who can already be using it on EURUSD at least.
Close doesn't always have to be 400 pips, you might want to close on a logical level such as strong resistance or a trendline too.
Thanks to:
• @everget for providing Supertrend solution.
• Satik FX who hand-tested the system by hand and reported results in this  article . He is my main inspiration for creating the complete indicator as one because I want to be able to show and hide it with a single click.  My future scripts will also work as a whole strategy each by itself. 
• The number in the script's name comes from Satik's numbering. A mentioned article was his seventh shared strategy.
Combo Backtest 123 Reversal & Donchian Channel Width This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 The Donchian Channel was developed by Richard Donchian and it could be compared 
 to the Bollinger Bands. When it comes to volatility analysis, the Donchian Channel 
 Width was created in the same way as the Bollinger Bandwidth technical indicator was.
 As was mentioned above the Donchian Channel Width is used in technical analysis to measure 
 volatility. Volatility is one of the most important parameters in technical analysis. 
 A price trend is not just about a price change. It is also about volume traded during this 
 price change and volatility of a this price change. When a technical analyst focuses his/her 
 attention solely on price analysis by ignoring volume and volatility, he/she only sees a part 
 of a complete picture only. This could lead to a situation when a trader may miss something and 
 lose money. Lets take a look at a simple example how volatility may help a trader:
    Most of the price based technical indicators are lagging indicators.
    When price moves on low volatility, it takes time for a price trend to change its direction and 
 it could be ok to have some lag in an indicator.
    When price moves on high volatility, a price trend changes its direction faster and stronger. 
 An indicator's lag acceptable under low volatility could be financially suicidal now - Buy/Sell signals could be generated when it is already too late.
 Another use of volatility - very popular one - it is to adapt a stop loss strategy to it:
    Smaller stop-loss recommended in low volatility periods. If it is not done, a stop-loss could 
 be generated when it is too late.
    Bigger stop-loss recommended in high volatility periods. If it is not done, a stop-loss could 
 be triggered too often and you may miss good trades.
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Strategy 123 Reversal & Donchian Channel WidthThis is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 The Donchian Channel was developed by Richard Donchian and it could be compared 
 to the Bollinger Bands. When it comes to volatility analysis, the Donchian Channel 
 Width was created in the same way as the Bollinger Bandwidth technical indicator was.
 As was mentioned above the Donchian Channel Width is used in technical analysis to measure 
 volatility. Volatility is one of the most important parameters in technical analysis. 
 A price trend is not just about a price change. It is also about volume traded during this 
 price change and volatility of a this price change. When a technical analyst focuses his/her 
 attention solely on price analysis by ignoring volume and volatility, he/she only sees a part 
 of a complete picture only. This could lead to a situation when a trader may miss something and 
 lose money. Lets take a look at a simple example how volatility may help a trader:
    Most of the price based technical indicators are lagging indicators.
    When price moves on low volatility, it takes time for a price trend to change its direction and 
 it could be ok to have some lag in an indicator.
    When price moves on high volatility, a price trend changes its direction faster and stronger. 
 An indicator's lag acceptable under low volatility could be financially suicidal now - Buy/Sell signals could be generated when it is already too late.
 Another use of volatility - very popular one - it is to adapt a stop loss strategy to it:
    Smaller stop-loss recommended in low volatility periods. If it is not done, a stop-loss could 
 be generated when it is too late.
    Bigger stop-loss recommended in high volatility periods. If it is not done, a stop-loss could 
 be triggered too often and you may miss good trades.
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Backtest 123 Reversal & CMOaDisparity Index This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 The related CMOaDisparity Index article is copyrighted material from Stocks & Commodities Dec 2009
 My strategy modification.
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Strategy 123 Reversal & CMOaDisparity Index This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 The related CMO Disparity Index article is copyrighted material from Stocks & Commodities Dec 2009
 My strategy modification.
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Backtest 123 Reversal & Directional Trend Index (DTI) This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 This technique was described by William Blau in his book "Momentum,
 Direction and Divergence" (1995). His book focuses on three key aspects 
 of trading: momentum, direction and divergence. Blau, who was an electrical 
 engineer before becoming a trader, thoroughly examines the relationship between 
 price and momentum in step-by-step examples. From this grounding, he then looks 
 at the deficiencies in other oscillators and introduces some innovative techniques, 
 including a fresh twist on Stochastics. On directional issues, he analyzes the 
 intricacies of ADX and offers a unique approach to help define trending and 
 non-trending periods.
 Directional Trend Index is an indicator similar to DM+ developed by Welles Wilder. 
 The DM+ (a part of Directional Movement System which includes both DM+ and 
 DM- indicators) indicator helps determine if a security is "trending." William 
 Blau added to it a zeroline, relative to which the indicator is deemed positive or 
 negative. A stable uptrend is a period when the DTI value is positive and rising, a 
 downtrend when it is negative and falling. 
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Strategy 123 Reversal & Directional Trend Index (DTI) This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 This technique was described by William Blau in his book "Momentum,
 Direction and Divergence" (1995). His book focuses on three key aspects 
 of trading: momentum, direction and divergence. Blau, who was an electrical 
 engineer before becoming a trader, thoroughly examines the relationship between 
 price and momentum in step-by-step examples. From this grounding, he then looks 
 at the deficiencies in other oscillators and introduces some innovative techniques, 
 including a fresh twist on Stochastics. On directional issues, he analyzes the 
 intricacies of ADX and offers a unique approach to help define trending and 
 non-trending periods.
 Directional Trend Index is an indicator similar to DM+ developed by Welles Wilder. 
 The DM+ (a part of Directional Movement System which includes both DM+ and 
 DM- indicators) indicator helps determine if a security is "trending." William 
 Blau added to it a zeroline, relative to which the indicator is deemed positive or 
 negative. A stable uptrend is a period when the DTI value is positive and rising, a 
 downtrend when it is negative and falling. 
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Backtest 123 Reversal & DiNapoli Detrended Oscillator This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 DiNapoli Detrended Oscillator Strategy
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Strategy 123 Reversal & DiNapoli Detrended Oscillator This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 DiNapoli Detrended Oscillator Strategy
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Backtest 123 Detrended Price Oscillator This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 The Detrend Price Osc indicator is similar to a moving average, 
 in that it filters out trends in prices to more easily identify 
 cycles. The indicator is an attempt to define cycles in a trend 
 by drawing a moving average as a horizontal straight line and 
 placing prices along the line according to their relation to a 
 moving average. It provides a means of identifying underlying 
 cycles not apparent when the moving average is viewed within a 
 price chart. Cycles of a longer duration than the Length (number 
 of bars used to calculate the Detrend Price Osc) are effectively 
 filtered or removed by the oscillator.
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Combo Strategy 123 Detrended Price Oscillator This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 The Detrend Price Osc indicator is similar to a moving average, 
 in that it filters out trends in prices to more easily identify 
 cycles. The indicator is an attempt to define cycles in a trend 
 by drawing a moving average as a horizontal straight line and 
 placing prices along the line according to their relation to a 
 moving average. It provides a means of identifying underlying 
 cycles not apparent when the moving average is viewed within a 
 price chart. Cycles of a longer duration than the Length (number 
 of bars used to calculate the Detrend Price Osc) are effectively 
 filtered or removed by the oscillator.
 WARNING:
 - For purpose educate only
 - This script to change bars colors.
Leverage Strategy and a few words on risk/opportunityHello traders,
I started this script as a joke for someone... finally appears it could be used for educational content
Let's talk about leverage and margin call
 Margin Call 
A margin call is the broker's demand that an investor deposit additional money or securities so that the account is brought up to the minimum value, known as the maintenance margin. 
A margin call usually means that one or more of the securities held in the margin account has decreased in value below a certain point.
 Leverage 
A leverage is a system which allows the trader to open positions much larger than his own capital. ... “Leverage” usually refers to the ratio between the position value and the investment needed,
 Strat 
The strategy simulates long/short positions on a 4h high/low breakout based on the chart candle close.
The panel below shows the strategy equity curve. Activating the margin call option will show when the account would be margin called giving the settings
 Casino 
I'm not doing any financial recommendation here.
I made this strategy so that people include more risk management metrics into their strategy.
From the code, we see it's fairly easy to calculate a leveraged position size and a margin call flag - when that flag is hit, the system stops trading.
I simplified things to the extreme here but my point is that the leverage is a double-edge sword gift. 
Assuming we always take the same position sizing, increasing the leverage speed up how fast a margin could be ..... called. (bad joke? feel free to tell me). Not saying it will, saying it introduces more risk by design.
Then one could say "I'll just turn off that stupid margin call option". And that's when someone starts backtesting with unrealistic market conditions.
 Finally... 
When I backtest I always assume the worst in every scenario possible (because I'm French), I always try to minimize the risk first (also because I'm French), keeping as close from 0 as possible (French again)
Then I add the "opportunity" component, looking to catch the maximum of opportunity while keeping the risk low.
It's like a  Rubix cube  puzzle - decreasing the risk is one side of the equation but whenever I try to catch more opportunity... my risks increases. 
Then I update my risk... and now the opportunity decreases... (#wut #wen #simple)
Completely removing the risk from a trading strategy isn't something I wouldn't dare doing.
Trading involves risk. Being obsessed by decreasing the risk is what I do BEST :) 
Dave
Combo Backtest 123 Reversal & DAPD This is combo strategies for get a cumulative signal. 
 First strategy
 This System was created from the Book "How I Tripled My Money In The 
 Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
 The strategy buys at market, if close price is higher than the previous close 
 during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
 The strategy sells at market, if close price is lower than the previous close price 
 during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
 Second strategy
 This indicator is similar to Bollinger Bands. It based on DAPD - Daily
 Average Price Delta. DAPD is based upon a summation for each of the
 highs (hod) for the 21 days prior to today minus the summation for
 each of the lows (lod) for the last 21 days prior to today. The result
 of this calculation would then be divided by 21.
 It will be buy when high above previos DAPD high and sell if low below previos DAPD low
 WARNING:
 - For purpose educate only
 - This script to change bars colors.






















